package com.molichuxing.services.property;


/**
 * 年检状态
 *
 * @author zhaopenghui
 */
public enum YearlyInspectHandleWayEnum {

    /**
     * 第三方办理
     */
    THIRD_PARTY_HANDLE(0, "第三方办理"),
    /**
     * 用户自行办理
     */
    USER_HANDLE(1, "用户自行办理");


    int value;
    String name;

    YearlyInspectHandleWayEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }


    /**
     * 通过value获取枚举的name
     *
     * @param value
     * @return
     */
    public static String getName(int value) {
        YearlyInspectHandleWayEnum enumerate = getEnum(value);
        return enumerate == null ? null : enumerate.getName();
    }

    /**
     * 通过value获取枚举
     *
     * @param value
     * @return
     */
    public static YearlyInspectHandleWayEnum getEnum(int value) {
        for (YearlyInspectHandleWayEnum enumerate : YearlyInspectHandleWayEnum.values()) {
            if (enumerate.getValue() == value) {
                return enumerate;
            }
        }
        return null;
    }
}
